import { inject } from 'vue';
import {message} from "../../index";
export default (props,{slots,emit}) => {
  const dialogConfig = inject('dialogConfig');
  if(!dialogConfig) {
    message.warning('[Eldialog] 没有获取到 dialogConfig，请确保父组件使用了 provide');
    return null;
  };
  return (
    <el-dialog
      modelValue={dialogConfig.modelValue}
      width={dialogConfig.width}
      draggable={dialogConfig.draggable}
      title={dialogConfig.title}
      closeOnClickModal={dialogConfig.closeOnClickModal}
      closeOnPressEscape={dialogConfig.closeOnPressEscape}
      destroyOnClose={dialogConfig.destroyOnClose}
      showClose={dialogConfig.showClose}
      center={dialogConfig.center}
      fullscreen={dialogConfig.fullscreen}
      overflow
      onClose={dialogConfig.close}
      onOpen={dialogConfig.open}
      appendToBody
    >
      {slots.header?.()}
      {slots.default?.()}
      {slots.footer?.()}
    </el-dialog>
  )
}